package com.haoting.mamba.player.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.haoting.mamba.player.entity.PlaySupportsEntity;
import com.haoting.mamba.player.service.PlaySupportsService;
import com.haoting.common.utils.PageUtils;
import com.haoting.common.utils.R;



/**
 * 
 *
 * @author tanghao
 * @email 767417609@qq.com
 * @date 2021-03-14 20:47:40
 */
@RestController
@RequestMapping("player/playsupports")
public class PlaySupportsController {
    @Autowired
    private PlaySupportsService playSupportsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = playSupportsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{userId}")
    public R info(@PathVariable("userId") String userId){
		PlaySupportsEntity playSupports = playSupportsService.getById(userId);

        return R.ok().put("playSupports", playSupports);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody PlaySupportsEntity playSupports){
		playSupportsService.save(playSupports);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody PlaySupportsEntity playSupports){
		playSupportsService.updateById(playSupports);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] userIds){
		playSupportsService.removeByIds(Arrays.asList(userIds));

        return R.ok();
    }

}
